'use strict'

$(function () {
    $.get('http://localhost:3000/product', (res) => {
        console.log(res);
        res.forEach(item => {
            let html = `
            <tr>
                <td>${item.id}</td>
                <td>${item.productName}</td>
                <td>${item.price}</td>
                <td>${item.stockNum}</td>
                <td>${item.supplier}</td>
                <td>${item.remark}</td>
                <td>
                    <input type='button' value='编辑' onclick='Edit(${item.id})'>
                    <input type='button' value='删除' onclick='delProduct(${item.id})'>
                </td>
            <tr>
            `
            $('table').append(html)
        })

    })
})

